public class StringDemo6 {
    public static void main(String[] args) {
        int[]arr={1,3,46,4,56,7,8,8};
        String s=getString(arr);
        System.out.println(s);
    }

    public static String getString(int[] arr){
        StringBuilder sb=new StringBuilder("[");
        for (int i = 0; i <arr.length ; i++) {
            if(i==arr.length-1){
                sb.append(i).append("]");
            }else{
                sb.append(arr[i]).append(',');
            }
        }
        String sb1=sb.toString();
        return sb1;
    }


}
